package base;

import java.io.IOException;

import javax.bluetooth.BluetoothStateException;

import exceptions.*;

public interface Communication {

	/** initializes the communication class 
	 * @throws InitializedException 
	 * @throws BluetoothStateException 
	 * @throws IOException */
	public void init() throws InitializedException, BluetoothStateException, IOException;

	/** connects to a given user 
	 * @throws IOException 
	 * @throws ConnectedException */
	public boolean connect(String url) throws ConnectedException;
	
	/** disconnects from a user 
	 * @throws NotConnectedException */
	public boolean disconnect() throws NotConnectedException;

	/** sends a message to the connected user */
	public boolean send(String url, String msg);

//	/** register a receiver, this receiver is called when a message arrives */
//	public boolean addMessageListner(MessageListener rcv);

	/** return a string with the user found by an inquiry 
	 * @throws BluetoothStateException */
	public String[] search() throws BluetoothStateException;
	
	public boolean startReceiver(String url, MessageListener listener);
	public boolean stopReceiver();
}
